<template>
  <div style="background: #fff">
    <div class="title">
      <div>{{ title }}</div>
    </div>
     <div style="text-align:right">
      <el-form :inline="true">
        <el-form-item>
          <el-button type="primary" @click="showEdit(false)">添加</el-button>
        </el-form-item>
      </el-form>
    </div>
    <el-table
      :data="data"
      stripe
      style="width: 100%; margin-bottom: 1.875rem"
    
    >
      </el-table-column>
      <el-table-column prop="id" label="id"></el-table-column>
      <el-table-column prop="name" label="名称"></el-table-column>
       <el-table-column label="操作">
        <template slot-scope="scope">
              <el-button size="small" @click="showEdit(scope.row)">编辑</el-button>
          <el-button size="small" @click="del(scope.row)">删除</el-button>
        </template>
      </el-table-column>
     
    </el-table>
     

    <el-dialog title="编辑" :visible.sync="editModal" width="40%" :close-on-click-modal='false'>
        <el-form :model="item">
          <el-form-item label="标题">
            <el-input v-model="item.name" autocomplete="off" clearable></el-input>
          </el-form-item>
            
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="editModal = false">取 消</el-button>
          <el-button type="primary" @click="edit">确 定</el-button>
        </div>
      </el-dialog>
  
  </div>
</template>

<script>
import mixin from "../../js/mixin";

export default {
  name: "msg",
  mixins: [mixin],
  data() {
    return {
      is_page: false,
      api_url: "hot",
      query: {},
    };
  },
  components: {},
  mounted() {},
  created() {
    this.title = this.$route.meta.title;
    this.init();
  },
  methods: {
    init() {
      this.getData();
    },

    showEdit(e) {
      if (e) {
        this.item = e;
      }
      this.editModal = true;
    },
  },
};
</script>

<style scoped>
</style>
